package backtrack;

/**
 * @author le
 */
public class TheRaceTimes {

    public static void main(String[] args) {
        int n = 7;
        int count = 0;
        while(n >= 1){
            if (n % 2 == 0){
                int temp = 0;
                temp = n/2;
                count += temp;
                n = temp;
            }else{
                int temp = 0;
                temp = (n-1)/2;
                count += temp;
                n = temp + 1;
            }

        }
        System.out.println(count);
    }
}
